package br.com.iswe.teste.hibernate;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.SessionFactoryUtils;

public class HibernateTestCaseHelper {

	public static void initRequest(SessionFactory sessionFactory) {
		if(sessionFactory == null)return;
		if (SessionFactoryUtils.isDeferredCloseActive(sessionFactory)) {}
		else {
			SessionFactoryUtils.initDeferredClose(sessionFactory);
		}
	}

	public static void endRequest(SessionFactory sessionFactory) {
		if(sessionFactory == null)return;
		SessionFactoryUtils.processDeferredClose(sessionFactory);
	}

}
